package com.sumainfor.zuul.controller.Feign;

import com.sumainfor.common.util.FieldCheckUtil;
import com.sumainfor.common.util.JsonResult;
import com.sumainfor.zuul.service.impl.AreaService;
import com.sumainfor.zuul.service.impl.Feign.AreaPayService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;
import java.util.Map;

/**
 * 功能描述:
 * 归属区域微信资料
 * @Auther: zhlu
 * @Date: 2019/3/26 18:22
 * @Description:
 */
@RestController
@RequestMapping("/provider/area")
public class AreaPayController {

    @Autowired
    AreaPayService AreaPayService;

    @Autowired
    AreaService AreaService;

    /**
     * 功能描述: 
     * 根据当前公司编号获取公司微信支付账户资料
     * @Author zhlu
     * @Description //TODO
     * @Date 2019/3/26 18:24
     */
    @GetMapping("/getAreaPayMap")
    public JsonResult getAreaPayMap(@RequestParam Map<String,Object> params){
        JsonResult result=new JsonResult();
        params.put("type",1);//区域类型 0.总经办 1公司  2.省份  3.市  4.县  5.区
        if(!FieldCheckUtil.isMapFieldNotNull(params,new String[]{"AreaId"})){
            result.putFailed("AreaId不能为空！");
            return  result;
        }
        result.put(AreaPayService.getAreaPayMap(params));
        return result;
    }

    /**
     * 功能描述:
     * 获取所有的公司编号和名称
     * @Author zhlu
     * @Description //TODO
     * @Date 2019/6/17 19:18
     */
    @GetMapping("/getAllAreaList")
    public List<Map<String,Object>>getAllAreaList(){
        return AreaService.getAllAreaList();
    }





    @PostMapping("/getAreaid")
    public JsonResult getAreaid(@RequestBody Map<String,Object> params){
        return AreaService.getAreaid(params);
    }

    @PostMapping("/getdeptname")
    public Map<String,Object> getdeptname(@RequestBody Map<String,Object> params){
        return AreaService.getdeptname(params);
    }



}
